package com.soft.line.mapper;

import com.soft.line.entity.ContractInfo;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Map;

public interface ContractInfoMapper {

    int insert(ContractInfo contractInfo);

    int insertRecord(ContractInfo record);

    int delete(Map<String,Object> map);

    int update(ContractInfo contractInfo);

    ContractInfo selectByPrimaryKey(Integer id);

    List<ContractInfo> selectAll(Map<String,Object> map);

    List<ContractInfo> selectAllNaturesByIdList(@Param("idList")List<Integer> idList);

    List<ContractInfo> getAllAboutContracts(Map<String,Object> map);

    int countContractByIdAndName(@Param("id")Integer id,@Param("contractName")String contractName);

    List<ContractInfo> getAllByIdList(Map<String,Object> map);

    List<ContractInfo> getAllCNByIdList(@Param("idList")List<Integer> idList);

    //根据部门分组查询数量(今年)
    List<Map<String, Object>> countNumGroupByDepThisYear();

    //根据部门分组查询历年数量
    List<Map<String, Object>> countDepGroupByYear(@Param("dep")String dep);

    //合同类型统计
    List<Map<String, Object>> countNumByTypeYear();

    //今年合同总数
    int countThisYearContract();

    //合同总金额排行榜
    List<Map<String, Object>> amountRanking();

    //部门合同排行榜
    List<Map<String, Object>> depRanking();

    //某年合同总数
    List<Map<String, Object>> sumContractByYear(@Param("year") String year);

    //某年合同性质（收入，支出，净收益（收入-支出））
    List<Map<String, Object>> sumContractNatureByYear(@Param("year") String year);

    //某年合同性质（收入，支出，净收益（收入-支出））
    List<Map<String, Object>> sumContractNatureByYearAndDep(@Param("year") String year,@Param("depIdList")List<String> depIdList);

    //根据部门分组查询数量
    List<Map<String, Object>> countNumGroupByDep(@Param("depIdList")List<String> depIdList);

}